package com.jiangruan.javaproject.service;

import com.alibaba.fastjson.JSONObject;
import com.jiangruan.javaproject.Constans;
import com.jiangruan.javaproject.bean.HotVideo;
import com.jiangruan.javaproject.bean.HotVideoCommon;
import com.jiangruan.javaproject.request.HttpUtils;

import java.util.List;

/**
 * @author:SAVA ME(未蒙救赎)
 * @email:1902586238@qq.com
 * @desc:
 * @datetime:2021/12/21 9:26
 **/
public class HotVideoService {
 public List<HotVideo> getHotVideo(){
     /**
      * 该方法用于获取热门数据，并将热门数据返回
      * @retun
      */

     String url = Constans.Trip_URL
             + "?key=" + Constans.Trip_KEY
             + "&type=hot_video "
             + "&size=20";

     String result = HttpUtils.git(url);
     System.out.println(result);

     //json解析
     HotVideoCommon videoCommon = JSONObject.parseObject(result, HotVideoCommon.class);
     return videoCommon.result;
 }
}
